package cfg

import (
	"encoding/json"
	"io/ioutil"
	"log"
)

type Monitor struct {
	Grafana string   `json:"grafana"`
	Png     string   `json:"png"`
	WsPf    []string `json:"ws_pf"`
	MarPf   []string `json:"mar_pf"`
	GloPf   []string `json:"glo_pf"`
}

func ReadJsonCfg() (*Monitor, bool) {
	var cfg Monitor
	filename := "config/config0.json"
	data, err := ioutil.ReadFile(filename)
	if err != nil {
		log.Panicln(err)
	}

	err1 := json.Unmarshal(data, &cfg)
	if err1 != nil {
		log.Panicln(err1)
	}

	return &cfg, true
}
